<template>
  <div id="main">
    <el-container class="main-content">
      <el-aside :width="Fold ? '60px' : '210px'">
        <NavMenu :collapse="Fold" />
      </el-aside>
      <el-container class="page">
        <el-header class="page-header">
          <Header @foldChange="headerfold" />
        </el-header>
        <el-main class="page-content">
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import { NavMenu } from '@/components/nav-menu/index'
import { Header } from '@/components/nav-header/index'

export default defineComponent({
  components: {
    NavMenu,
    Header,
  },

  setup() {
    const Fold = ref(false)
    const headerfold = (isFold: boolean) => {
      Fold.value = isFold
    }
    return { headerfold, Fold }
  },
})
</script>

<style scoped lang="less">
#main {
  position: fixed;
  top: 0%;
  left: 0%;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  .main-content,
  .page {
    height: 100%;
  }

  .page-content {
    height: calc(100%-48px);
  }
  .el-header,
  .el-footer {
    display: flex;
    color: #333;
    text-align: center;
    align-items: center;
  }
  .el-header {
    height: 48px !important;
  }
  .el-aside {
    overflow-x: hidden;
    overflow-y: auto;
    // line-height: 200px;
    text-align: left;
    cursor: pointer;
    background-color: #001529;
    transition: width 0.3s linear;
    scrollbar-width: none;
    &::-webpack-scrollbar {
      display: none;
    }
  }

  .el-main {
    color: #333;
    text-align: center;
    background-color: #f0f2f5;
  }
}
</style>
